package jse;

import java.util.Arrays;
import java.util.Random;

public class GetCard {
	
	public static void main(String[] args) {
		//设置牌数
		String[] cards={"1","2","3","4","5","6"};
		// 抽取的
		String[] getCards=new String[5];
		//随机数
		Random r=new Random();
		//设置标记
		boolean[] used=new boolean[cards.length];
		//索引
		int index=0;
		while(index<getCards.length){
			int use=r.nextInt(cards.length);
			if(used[use])
				continue;
			getCards[index++]=cards[use];
			used[use]=true;
		}
		System.out.println(Arrays.toString(getCards));
		
	}

	
	
}
